package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.ReturnedPurchaseInvoiceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author zhouwq
 * @date 2020/2/24 15:28
 */
@Repository
@Mapper
public interface ReturnedPurchaseInvoiceDao {

    /**
     * 插入数据
     *
     * @param returnedPurchaseInvoiceEntity 实体数据
     * @return 成功返回id
     **/
    Integer insert(ReturnedPurchaseInvoiceEntity returnedPurchaseInvoiceEntity);

    /**
     * 更新数据
     *
     * @param returnedPurchaseInvoiceEntity 实体数据
     * @return 成功返回id
     **/
    Integer update(ReturnedPurchaseInvoiceEntity returnedPurchaseInvoiceEntity);

    /**
     * 获取id
     *
     * @param param 参数
     * @return id
     */
    List<Long> getInvoiceId(@Param("param") Map<String, Object> param);

    /**
     * 根据采购退货list删除
     *
     * @param corpid       公司id
     * @param returnedPurchaseIdList 采购退货list
     * @return
     */
    Integer deleteBatchByReturnedPurchaseIdIn(@Param("corpid") String corpid, @Param("returnedPurchaseIdIn") List<Long> returnedPurchaseIdList);

    /**
     * 根据采购退货list回滚数据
     *
     * @param corpid       公司id
     * @param returnedPurchaseIdList 采购退货list
     * @return
     */
    Integer updateRollbackByReturnedPurchaseId(@Param("corpid") String corpid, @Param("returnedPurchaseIdIn") List<Long> returnedPurchaseIdList);

    /**
     * 根据发票id删除
     *
     * @param invoiceId 发票id
     * @param corpid    公司id
     * @return 是否成功
     */
    Integer deleteByInvoiceId(@Param("invoiceId") Long invoiceId, @Param("corpid") String corpid);

    /**
     * 根据参数查询实体集合
     */
    List<ReturnedPurchaseInvoiceEntity> findEntitys(@Param("param") Map<String, Object> param);

    /**
     * 获取个数
     *
     * @param param 参数
     * @return 个数
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

}
